TeeJay released a new version of SpringGraph about four days ago. I saw the example scripts and the output from them and I thought "that's pretty cool."
I had the idea to show file links graphically so I installed GD and SpringGraph at work on my Windows XP box running AS Perl 5.8.3. I proceeded to try out the example scripts and well, one out of three scripts worked (OO worked but procedural and records did not). I fired off an email to him about it.
When I got home, I installed GD and SpringGraph on my Windows XP box running AS Perl 5.8.4. I once again tried out the example scripts and this time two of the three worked (oo and procedural worked but records did not). Once again I sent TeeJay an email about it.
I started to look into why it was failing and spent about a half an hour before I decided that it really wasn't worth it. I didn't need records for my project.
I started coding and in under 30 minutes I had a suitable proof of concept script. I didn't have to think about how to graph it. With SpringGraph, you just add nodes and then later add edges. Very nice. You have done a really good job TeeJay and I am looking forward to future versions.
Here's the script if you are curious:
#!/usr/bin/perl use strict; use warnings; use Cwd; use File::Find; use SpringGraph; my $graph = new SpringGraph; my $filename = 'oo_file_find.png'; find(\&process_files, cwd); # do your magic print "outputting as png.\n"; $graph->as_png($filename); print "finished.\n"; sub process_files { my $file = $_; return unless -f $file; return unless $file =~ /\.(?:p[l|m]|cgi)$/i; $graph->add_node($file, label => $file); open(FILE, '<', $file) or print "couldn't open $file\n" && return; while () { next if /^#/; if (/\buse\s/) { # I didn't use a next because I may want to find other files # in form action links, for example. Capture the module # information and strip everything after the first whitespace my ($match) = /\buse\s+(.*);/; $match = (split /\s/, $match)[0]; $graph->add_edge($file => $match); } } close FILE; }
Yes, it still requires some work : 0.02 means not done yet, although I have other modules on CPAN that are only 0.01 or 0.02 that are fairly solid ( or at least don't break or fail often).
Anyway I have a pre-release of version 0.03 at the digraph bit of my site if you want it.
I plan to spend a few days working out some stuff using paper and pencil (and rubber) before attacking all the geometry again.